﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using POSSystem.BLL;

namespace WebUI.Controls
{
    public partial class EditPurchaseDetailsCtrl : BaseEditControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
        }

        public string ProductName
        {
            get { return txtProductName.Text; }
            set { txtProductName.Text = value; }
        }

        public Decimal UnitPrice
        {
            get
            {
                return String.IsNullOrEmpty(txtUnitPrice.Text) ? 0 : Decimal.Parse(txtUnitPrice.Text);
            }
            set
            {
                txtUnitPrice.Text = value.ToString();
            }
        }

        public int Quantity
        {
            get
            {
                return String.IsNullOrEmpty(txtQuantity.Text) ? 0 : int.Parse(txtQuantity.Text);
            }
            set
            {
                txtQuantity.Text = value.ToString();
            }
        }

        public Decimal GST
        {
            get
            {
                return String.IsNullOrEmpty(txtGST.Text) ? 0 : int.Parse(txtGST.Text);
            }
            set
            {
                txtGST.Text = value.ToString();
            }
        }

        public Decimal Total
        {
            get
            {
                return String.IsNullOrEmpty(txtTotal.Text) ? 0 : Decimal.Parse(txtTotal.Text);
            }
            set
            {
                txtTotal.Text = value.ToString();
            }
        }

        //public void btnUpdate_OnClick(object sender, EventArgs e)
        //{
        //    Products.UpdateCost(ProductID, UnitPrice);
        //}

        public int ProductID
        {
            get { if (hidProductID.Value == "") return 0; return int.Parse(hidProductID.Value); }
            set { hidProductID.Value = value.ToString(); }
        }

        public bool SaveCostChange
        {
            get { return chkUpdate.Checked; }
        }
    }
}